<template>
  <div class="hello">
    <nav-header :seller="seller"></nav-header>
    <div class="tab">
      <div class="tab-item">
        <router-link to="/goods" exact>商品</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/seller">评价</router-link>
      </div>
      <div class="tab-item">
        <router-link to="/ratings">商家</router-link>
      </div>
    </div>

    <router-view :seller="seller"></router-view>
  </div>
</template>

<script>
import navHeader from "@/components/header/Header";
const ERR_OK = 0;
export default {
  name: "hello",
  data() {
    return {
      seller: {}
    };
  },
  created() {
    this.$http.get("/api/sell").then(response => {
      var res = response.body;
      if (res.errno === ERR_OK) {
        this.seller = res.data;
      }
    });
  },
  components: {
    navHeader
  }
};
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">
.tab {
  display: flex;
  height: 40px;
  line-height: 40px;
  position: relative;
}

.tab:after {
  display: block;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  border-top: 1px solid rgba(7, 17, 27, 0.1);
  content: ' ';
}

.tab .tab-item {
  flex: 1;
  text-align: center;
}

.tab a {
  display: block;
  font-size: 14px;
  color: rgb(77, 85, 93);
}

.tab a.router-link-active {
  color: rgb(240, 20, 20);
}
</style>
